import { createFromIconfontCN } from "@ant-design/icons";

type IconFontType = {
  type: string;
};

// 图标组件
export const IconFont: React.FC<IconFontType> = (props) => {
  const { type, ...options } = props;
  const Icon = createFromIconfontCN({
    scriptUrl: "/public/iconfont.js"
  });
  return <Icon type={type} {...options} />;
};

// 图标渲染
export const renderIcon = (icon: string) => {
  return <IconFont type={icon} />;
};
